Socket
Socket
Sign inDemoInstall

extend

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extend

Port of jQuery.extend for node.js and the browser


Version published
Maintainers
2
Created

What is extend?

The extend npm package is a utility for shallowly or deeply copying the properties of one object to another. It is commonly used to extend the properties of an object with the properties of one or more other objects.

What are extend's main functionalities?

Shallow extend

This feature allows you to copy the properties of one or more source objects to a target object without deep copying. Properties in the target object will be overwritten by properties in the sources if they have the same key.

{"var extend = require('extend');
var obj1 = { a: 1 };
var obj2 = { b: 2 };
var extended = extend(obj1, obj2);
// Result: { a: 1, b: 2 }"}

Deep extend

This feature allows you to perform a deep copy of the properties of one or more source objects into a target object. Nested objects and arrays will be recursively copied, rather than just copying the reference.

{"var extend = require('extend');
var obj1 = { a: { b: 1 } };
var obj2 = { a: { c: 2 } };
var extended = extend(true, obj1, obj2);
// Result: { a: { b: 1, c: 2 } }"}

Other packages similar to extend

Keywords

FAQs

Package last updated on 20 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc